package com.qk.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CoursesMapper {

    List<Course> selectListByCondition(String name, String subject, String target);

    @Delete("delete from course where id = #{id}")
    void deleteCourseById(Long id);

    @Insert("insert into course(id, subject, name, price, target, description, create_time, update_time) VALUES (#{id},#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insertCourse(Course course);

    @Select("select * from course where id = #{id}")
    Course selectById(Long id);

    void updateCourse(Course course);

    @Select("select * from course")
    List<Course> selectListAllCourses();

    @Select("select * from  course where subject = #{subject}")
    List<Course> selectListBySubject(String subject);
}
